package vip.sweet.biz.modular.comment.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vip.sweet.biz.modular.comment.mapper.BizCommentsMapper;
import vip.sweet.biz.modular.comment.params.BizCommentsAddParams;
import vip.sweet.biz.modular.comment.service.BizCommentsService;
import vip.sweet.biz.modular.comment.entity.BizComments;

import java.sql.Date;

/**
 * @author ASUS
 * @Date 2025/10/4 23:45
 * @Descripition
 */
@Service
public class BizCommentsServiceImpl extends ServiceImpl<BizCommentsMapper, BizComments> implements BizCommentsService {
    @Override
    public boolean add(BizCommentsAddParams addCommentsParams) {
        BizComments bizComments=BeanUtil.toBean(addCommentsParams, BizComments.class);
        bizComments.setDate(new Date(System.currentTimeMillis()));
        if (ObjectUtil.isNotEmpty(addCommentsParams))
            return save(bizComments);
        return false;
    }
}
